home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / utils / bibindex / biblook.h < prev    next >
C/C++ Source or Header  |  1993-05-31  |  3KB  |  114 lines

  1. #include <stdio.h>
  2. #if (__STDC__ || __cplusplus || c_plusplus)
  3. #include <stdlib.h>
  4. #endif /*  (__STDC__ || __cplusplus || c_plusplus) */
  5. #include <string.h>
  6. #include <ctype.h>
  7. #include <sys/types.h>
  8. #include <sys/stat.h>
  9. #include <time.h>
  10. #if !__NeXT__
  11. #include <unistd.h>
  12. #include <malloc.h>
  13. #endif /* !__NeXT__ */
  14.  
  15. #if (__STDC__ || __cplusplus || c_plusplus)
  16. #define VOID    void
  17. #else /* NOT (__STDC__ || __cplusplus || c_plusplus) */
  18. #define VOID
  19. #endif /* (__STDC__ || __cplusplus || c_plusplus) */
  20.  
  21. #undef bcopy
  22. #define bcopy(source,target,length) \
  23.     memcpy((char*)(target),(const char*)(source),length)
  24.  
  25. #if sun
  26. #if __cplusplus
  27. extern "C" int    _filbuf(FILE *);    /* missing from stdio.h */
  28. #if !__GNUC__
  29. int    _flsbuf(unsigned char,FILE *);    /* missing from stdio.h */
  30. #endif /* !__GNUC__ */
  31. extern "C" int    _flsbuf(unsigned int, FILE *); /* missing from stdio.h */
  32. extern "C" char    *tempnam(const char *, const char *);
  33.                     /* not defined by acc's stdio.h */
  34. extern "C" int    waitpid(int, int *, int); /* not defined by any Sun .h file */
  35. #else /* NOT __cplusplus */
  36. int    _filbuf(FILE *);        /* missing from stdio.h */
  37. #if !__GNUC__
  38. int    _flsbuf(unsigned char,FILE *);    /* missing from stdio.h */
  39. #endif /* !__GNUC__ */
  40. char    *tempnam(const char *, const char *); /* not defined by acc's stdio.h */
  41. int    waitpid(int, int *, int);    /* not defined by any Sun .h file */
  42. #endif /* __cplusplus */
  43. #endif /* sun */
  44.  
  45. #if DEBUG_MALLOC
  46.             /* For dynamic memory debugging. */
  47.             /* Note that the parens around free and malloc */
  48.             /* are essential to prevent macro expansion in */
  49.             /* ANSI/ISO Standard C and C++.  Erroneous */
  50.             /* preprocessors will go into an infinite loop */
  51.             /* (e.g. SunOS /usr/CC/sun4/cpp) */
  52. #if sun
  53. int malloc_debug(int level);
  54. int malloc_verify(void);
  55. #else /* NOT sun */
  56. #define malloc_debug(level)    level
  57. #define malloc_verify()        1
  58. #endif /* sun */
  59. #undef free
  60. #undef malloc
  61. #define free(ptr) (malloc_verify(), \
  62.         fprintf(stderr,"line %d: free(%p)\n",(int)__LINE__,(ptr)), \
  63.         (free)(ptr))
  64. static void *p__;            /* for malloc() debugging */
  65. #define malloc(s) (malloc_verify(),\
  66.            p__ = (malloc)(s),\
  67.            fprintf(stderr,"line %d: malloc(%ld) -> %p\n",\
  68.                (int)__LINE__,(s),(p__)),\
  69.            p__)
  70. #endif /* DEBUG_MALLOC */
  71.  
  72. #if __NeXT__
  73. static char* p__;
  74. static char* q__;
  75. /* NB: This is not a general definition of tempnam(), but works for 
  76. this program! */
  77. #define tempnam(dir,pfx)    (p__ = tmpnam((char*)NULL), \
  78.                  q__ = malloc(strlen(p__)+1), \
  79.                  strcpy(q__,p__))
  80. #include <libc.h>            /* for struct rusage definition */
  81. #define waitpid(pid, statusp, options)    wait4((pid), (statusp), (options),\
  82.                           (struct rusage*)0)
  83. #endif /* __NeXT__ */
  84.  
  85. #if ardent
  86. /* Stardent has only simple wait-for-all-children function, sigh... */
  87. #define waitpid(pid, statusp, options)    wait((int*)0)
  88. char *getenv(const char *name);        /* missing from system header files */
  89. #endif
  90.  
  91. #if __hppa
  92. #include <sys/wait.h>
  93. #endif /* __hppa */
  94.  
  95. #if __sgi
  96. #include <sys/wait.h>
  97. #endif /* __sgi */
  98.  
  99. #define FILE_VERSION      2    /* file format version */
  100. #define MAJOR_VERSION     2    /* program version     */
  101. #define MINOR_VERSION     4
  102.  
  103. #define MAXWORD          31    /* maximum length of word indexed */
  104. typedef char Word[MAXWORD+1];
  105.  
  106. typedef unsigned short Index_t;
  107. #define INDEX_NAN 65535        /* maximum value representable as Index_t */
  108.  
  109. #define BADWORDS    {     /* words not to index */ \
  110.     "an", "and", "for", "in", "of", "on", "the", "to", "with", 0 \
  111. }
  112.  
  113. #define NONABBREV ",\n\t \"#%'()={}"    /* See LaTeX book, p.143 */
  114.